import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rembercount/controller/themeController.dart';
import 'package:rembercount/pages/homepage.dart';
import 'package:rembercount/pages/profile_page.dart';
import 'package:rembercount/pages/record_page.dart';
import 'package:rembercount/controller/authLoginController.dart';
import 'package:rembercount/pages/report_page.dart';

class MainPage extends StatefulWidget {
  const MainPage({super.key});

  @override
  State<MainPage> createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final Authlogincontroller authlogincontroller = Get.find<Authlogincontroller>();
  final ThemeController themeController=Get.find<ThemeController>();
  int _currentIndex = 0;
  
  final List<Widget> _pages = [
    Homepage(),
    // const RecordPage(),
    const ReportPage(),
    ProfilePage()
  ];

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () async => false,
      child: Scaffold(
        body: _pages[_currentIndex],
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: _currentIndex,
          onTap: (index) {
            setState(() {
              _currentIndex = index;
            });
          },
          selectedItemColor: themeController.themeColor,
          unselectedItemColor: Colors.grey,
          selectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold),
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: '首页',
            ),
            // BottomNavigationBarItem(
            //   icon: Icon(Icons.add_circle_outline),
            //   label: '记一笔',
            // ),
             BottomNavigationBarItem(
              icon: Icon(Icons.chat_rounded),
              label: '报表',
            ),
             BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: '我的',
            ),
          ],
        ),
      ),
    );
  }
} 